package cn.idu.jdbc;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

public class TestInsert01 {
    public static void main(String[] args) {
        Connection connection = null;
        Statement statement = null;
        ResultSet resultSet = null;
        try {

            connection = JdbcUtils.getConnector();
            //4. 执行sql的对象，去执行sql
            statement = connection.createStatement();//执行sql的对象
            String sql = "insert into users (id, name, password, email, birthday)" +
                    "values (4, 'dou', '123456', 'dou@sina.com', '1992-9-10');";
            int lines = statement.executeUpdate(sql);
            if (lines > 0) {
                System.out.println("插入成功");
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            JdbcUtils.release(connection, statement, resultSet);
        }

    }
}
